'use strict';

var mongoose = require('mongoose');
var modelPlugin = require("../model.plugin");
var Schema = mongoose.Schema;
var ObjectId  = Schema.ObjectId;

var articleSchema = new Schema({
  title: {type: String},
  subtitle: {type: String},
  description: {type: String},

  createdAt: {type: Date, default: Date.now},
  createdBy: {type: ObjectId, ref: 'User'},
  updatedAt: {type: Date, default: Date.now},
  updatedBy: {type: ObjectId, ref: 'User'}
});

articleSchema.plugin(modelPlugin);
// articleSchema.index({title: 1});

mongoose.model('Article', articleSchema);
